﻿using System;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Uow;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Modularity;

namespace youzackcom.EntityFrameworkCore;

[DependsOn(
    typeof(youzackcomDomainModule),
     typeof(AbpEntityFrameworkCoreModule),
    typeof(AbpEntityFrameworkCoreMySQLModule)
    )]
public class youzackcomEntityFrameworkCoreModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        //dotnet ef  migrations add project1   -c  youzackcomDbContext   --project  "E:\项目\ABP\youzack\youzackcom\aspnet-core\src\youzackcom.EntityFrameworkCore\youzackcom.EntityFrameworkCore.csproj"
        //dotnet ef database update   -c  youzackcomDbContext --project  "E:\项目\ABP\youzack\youzackcom\aspnet-core\src\youzackcom.EntityFrameworkCore\youzackcom.EntityFrameworkCore.csproj"
        context.Services.AddAbpDbContext<youzackcomDbContext>(options =>
        {
                /* Remove "includeAllEntities: true" to create
                 * default repositories only for aggregate roots */
            options.AddDefaultRepositories(includeAllEntities: true);
        });

        Configure<AbpDbContextOptions>(options =>
        {
                /* The main point to change your DBMS.
                 * See also youzackcomMigrationsDbContextFactory for EF Core tooling. */
            options.UseMySQL();
        });

    }
}
